<template>
  <a-modal
    title="审核"
    :maskClosable="false"
    :destroyOnClose="true"
    centered
    :width="400"
    v-model="visible"
    @ok="handleSubmit"
  >
    <div>
      <a-radio-group v-model="form.apStatus">
        <a-radio :value="3">申请通过</a-radio>
        <a-radio :value="2">驳回</a-radio>
      </a-radio-group>
      <a-textarea
        v-model="form.apText"
        placeholder="请输入审核原因"
        :rows="3"
        :maxLength="50"
        style="margin-top: 20px"
      ></a-textarea>
    </div>
  </a-modal>
</template>

<script>
import { CooperationApply } from '@/api/business/cooperation'
export default {
  data() {
    return {
      visible: false,
      form: {
        id: undefined,
        apStatus: 3, //3申请通过  2驳回
        apText: undefined,
      },
    }
  },
  methods: {
    show(id) {
      this.form.id = id
      this.form.apStatus = 3
      this.form.apText = undefined
      this.visible = true
    },
    async handleSubmit() {
      let { code, msg } = await CooperationApply({ ...this.form })
      this.$message[code === 0 ? 'success' : 'error'](msg)
      if (code === 0) this.$emit('success')
      this.visible = false
    },
  },
}
</script>

<style lang="less" scoped>
.content {
  padding-bottom: 20px;
}

.line1 {
  display: flex;
  align-items: center;
  .logo {
    height: 40px;
    width: 40px;
    border-radius: 50%;
  }
  .name {
    font-size: 16px;
    font-weight: bold;
    margin-left: 10px;
  }
}
.line2 {
  color: #999;
}
.line3 {
  .item {
    padding: 5px 10px;
    border: 1px #ccc solid;
    margin-right: 10px;
    border-radius: 5px;
  }
}
.line4 {
  font-weight: bold;
}
.mb20 {
  margin-bottom: 20px;
}
</style>